Skip to content

Conversation

@osanstrong
Copy link
Contributor

This pull request adds FerrariSolver, a class implementing the Ferrari-Cardano method to solve quartic polynomials of the form ax⁴ + bx³ + cx² + dx + e = 0, and QuarticSolver.test, a class with tests for quartic solvers.

The Ferrari-Cardano method solves a related cubic equation to find a factor which breaks the quartic equation into two quadratic equations, which are then solved for the final roots.

The QuarticSolver test file contains a brief abstract framework for testing quartic functions, and a specific subclass FerrariSolverTest which plugs in FerrariSolver for those tests. Most of the tests can then be easily reused to test an alternative quartic solver, with a different subclass.

… required higher precision than tolerance allowed
…fixed backwards iterator, fixed a couple of arithmetic bugs
@github-actions
Copy link

github-actions bot commented Oct 6, 2025

Test summary

 5 750 files   9 236 suites   18m 7s ⏱️
 2 088 tests  2 062 ✅  26 💤 0 ❌
32 224 runs  32 102 ✅ 122 💤 0 ❌

Results for commit 1221aa8.

♻️ This comment has been updated with latest results.

@sethrj sethrj requested a review from elliottbiondo October 6, 2025 12:43
@sethrj sethrj requested review from Copilot and sethrj October 6, 2025 12:43
@sethrj sethrj added enhancement New feature or request orange Work on ORANGE geometry engine labels Oct 6, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request adds a Ferrari-Cardano method implementation for solving quartic polynomial equations and a comprehensive test suite. The implementation is designed to find positive, real, non-zero roots for quartic functions used in geometric surface calculations.

Key changes include:

  • Implementation of the Ferrari-Cardano algorithm in FerrariSolver class
  • Comprehensive test framework for quartic solvers with abstract base class design
  • Addition of CMake preset configurations for development workflows

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 6 comments.

File Description
src/orange/surf/detail/FerrariSolver.hh Core implementation of Ferrari-Cardano quartic solver with cubic and quadratic utility functions
test/orange/surf/detail/QuarticSolver.test.cc Abstract test framework and specific Ferrari solver tests covering various root scenarios
test/orange/CMakeLists.txt Registration of new quartic solver test
scripts/cmake-presets/.json CMake preset configurations for development builds

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link
Contributor

@elliottbiondo elliottbiondo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is basically ready to merge: just a few minor comments

Copy link
Member

@sethrj sethrj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great Owen! Just a few final comments based on the changes.

@sethrj
Copy link
Member

sethrj commented Dec 5, 2025

@elliottbiondo I think this is ready to merge!

@sethrj
Copy link
Member

sethrj commented Dec 5, 2025

@osanstrong @elliottbiondo Since we've made the solver more generic, I've moved it to its rightful place in corecel/math. I also made a couple of small adjustments to the documentation so that the key capabilities appear in the user docs. Thanks again!

@sethrj sethrj dismissed elliottbiondo’s stale review December 5, 2025 13:43

Changes have been addressed!

This reverts commit 303a17b.
@sethrj
Copy link
Member

sethrj commented Dec 5, 2025

Copy link
Contributor

@elliottbiondo elliottbiondo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes look good to me. Let's wait for @osanstrong to take a look before merging.

@sethrj sethrj enabled auto-merge (squash) December 10, 2025 12:00
@sethrj
Copy link
Member

sethrj commented Dec 10, 2025

@elliottbiondo I'm going to merge this unless @osanstrong says otherwise. Thanks guys! Next step, basic torus support?

@sethrj sethrj merged commit 0bc7893 into celeritas-project:develop Dec 10, 2025
44 checks passed
@osanstrong
Copy link
Contributor Author

Looks good to me! (sorry for not getting back to you faster) Only question I had atp was if you think it's generic enough to be in corecel, should it also return negative roots and let the torus code ignore them? Thanks for the last edits!

@sethrj
Copy link
Member

sethrj commented Dec 10, 2025

I thought about that, and if we ever need nonpositive roots, we can easily make it more generic by constructing with a "filter" template argument.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request orange Work on ORANGE geometry engine

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants